﻿/**
 * @file maincontroller.h
 * @author huangxb
 * @email 18228033207@163.com
 * @date 2025-04-08
 * @brief 主窗口视图控制器.
 */
#ifndef MAINCONTROLLER_H
#define MAINCONTROLLER_H

#include <QSharedPointer>
#include <QObject>

class QStandardItemModel;
class QModelIndex;
class MainWindow;
class CGIFViewController;

class CMainController : public QObject
{
    Q_OBJECT

private:
    enum TreeColumn
    {
        Column_Name = 0,
        Column_Count,
    };
    enum TreeDataRole
    {
        DataRole_Component = Qt::UserRole + 1,
    };
    enum ComponentType
    {
        Component_None = 0,
        Component_Button,
        Component_LineEdit,
        Component_Gif,
        Component_Table,
        Component_Window,
    };

    MainWindow* m_pMainView = nullptr;
    QStandardItemModel* m_pComponentModel = nullptr;

    ComponentType m_eCurrentShowComponent = Component_None;
    QSharedPointer<CGIFViewController> m_spGIFController;

public:
    explicit CMainController(QObject *parent = nullptr);

    void SetView(MainWindow* pView);

    void InitComponentModel();
    QStandardItemModel* GetComponentModel();

    void DoubleClickComponent(const QModelIndex& index);

signals:

};

#endif // MAINCONTROLLER_H
